package com.ruoyi.portal.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.portal.mapper.RecruitmentMapper;
import com.ruoyi.portal.domain.Recruitment;
import com.ruoyi.portal.service.IRecruitmentService;

/**
 * 招聘Service业务层处理
 *
 * @author cjie
 * @date 2021-06-13
 */
@Service
public class RecruitmentServiceImpl implements IRecruitmentService {
    @Autowired
    private RecruitmentMapper recruitmentMapper;

    /**
     * 查询招聘
     *
     * @param id 招聘ID
     * @return 招聘
     */
    @Override
    public Recruitment selectRecruitmentById(Long id) {
        return recruitmentMapper.selectRecruitmentById(id);
    }

    /**
     * 查询招聘列表
     *
     * @param recruitment 招聘
     * @return 招聘
     */
    @Override
    public List<Recruitment> selectRecruitmentList(Recruitment recruitment) {
        return recruitmentMapper.selectRecruitmentList(recruitment);
    }

    /**
     * 新增招聘
     *
     * @param recruitment 招聘
     * @return 结果
     */
    @Override
    public int insertRecruitment(Recruitment recruitment) {
        recruitment.setCreateTime(DateUtils.getNowDate());
        recruitment.setCreateBy(SecurityUtils.getUsername());
        return recruitmentMapper.insertRecruitment(recruitment);
    }

    /**
     * 修改招聘
     *
     * @param recruitment 招聘
     * @return 结果
     */
    @Override
    public int updateRecruitment(Recruitment recruitment) {
        recruitment.setUpdateTime(DateUtils.getNowDate());
        recruitment.setUpdateBy(SecurityUtils.getUsername());
        return recruitmentMapper.updateRecruitment(recruitment);
    }

    /**
     * 批量删除招聘
     *
     * @param ids 需要删除的招聘ID
     * @return 结果
     */
    @Override
    public int deleteRecruitmentByIds(Long[] ids) {
        return recruitmentMapper.deleteRecruitmentByIds(ids);
    }

    /**
     * 删除招聘信息
     *
     * @param id 招聘ID
     * @return 结果
     */
    @Override
    public int deleteRecruitmentById(Long id) {
        return recruitmentMapper.deleteRecruitmentById(id);
    }
}
